package com.example.apphandlermessage;

import android.R.string;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ProgressBar;

public class MyThread implements Runnable {

	final String PROGRESS_KEY = "Progress";
	ProgressBar progress;
	Message message;
	Handler handler;
	private long fileSize = 0;

	@Override
	public void run() {

		for (int i = 0; i < 100; i++) {
			message =handler.obtainMessage();
			Bundle data = new  Bundle();
			
			handler.sendMessage(message);
			try {
				Thread.sleep(200);
			} catch (Exception e) {

			}
		}

	}

	public int doSomeTasks() {

		while (fileSize <= 1000000) {
               fileSize++;

			if (fileSize == 100000) {
				return 10;
			} else if (fileSize == 200000) {
				return 20;
			} else if (fileSize == 300000) {
				return 30;
			}
			
		}

		return 100;

	}

}
